//=============================================================================
#ifndef _CNETWORK_H_
    #define _CNETWORK_H_

#define WIN32_LEAN_AND_MEAN

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>

#include <windows.h>
#include <unistd.h>

#include <SDL.h>
#include <net2.h>

#include "CEvent.h"
#include "CLog.h"
#include "CNetworkMessage.h"
#include "CNetworkPacket.h"
#include "CNetworkStream.h"

#include "CClients.h"
#include "CPlayer.h"

//=============================================================================
class CNetwork : public CEvent {
	protected:
		static CNetwork* Instance;

    private:
        CClients Client;

	public:
		CNetwork();

		void OnUser(Uint8 type, int code, void* data1, void* data2);

		bool OnInit();

		void OnLoop();

		void OnCleanup();

	public:
		bool Connect(char* IP);

		void Disconnect();

		bool IsConnected();

	public:
		static int ClientLoop(void* ThreadData);

		static CNetwork* GetInstance();
};

//=============================================================================

#endif
